package br.com.guiaturistico.adapter;

import java.util.List;

import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.TextView;
import br.com.guiaturistico.R;
import br.com.guiaturistico.beans.HomeMenuBean;

public class HomeMenuAdapter extends BaseAdapter{

	private Activity activity;
	private List<HomeMenuBean> listaOpcoes;
	
	public HomeMenuAdapter(Activity activity, List<HomeMenuBean> listaOpcoes){
		
		this.activity = activity;
		this.listaOpcoes = listaOpcoes;
	}
	
	@Override
	public int getCount() {

		return listaOpcoes.size();
	}

	@Override
	public Object getItem(int indice) {

		return listaOpcoes.get(indice);
	}

	@Override
	public long getItemId(int indice) {

		return indice;
	}

	@Override
	public View getView(int indice, View view, ViewGroup viewGroup) {

		View paginaConteudo = (View) LayoutInflater.from(activity).inflate(R.layout.conteudo_home_menu, null);
		
		HomeMenuBean home = listaOpcoes.get(indice);
		
		ImageView imagemOpcao = (ImageView) paginaConteudo.findViewById(R.id.imagemOpcao);
		imagemOpcao.setImageResource(home.getImagemOpcao());
		
		TextView nomeOpcao = (TextView) paginaConteudo.findViewById(R.id.tituloOpcao);
		nomeOpcao.setText(home.getNomeOpcao());
				
		TextView descOpcao = (TextView) paginaConteudo.findViewById(R.id.descOpcao);
		descOpcao.setText(home.getDescOpcao());
		
		TextView indiceOpcao = (TextView) paginaConteudo.findViewById(R.id.indiceOpcao);
		indiceOpcao.setText(String.valueOf(indice));
		
		return paginaConteudo;
	}

	
	
}
